home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------------------
- *
- * Apple Developer Technical Support
- *
- * Printing routines
- *
- * Program: EditionSample
- * File: Print.c - C Source
- *
- * by: C.K. Haun <TR>
- *
- * Copyright © 1990,1991 Apple Computer, Inc.
- * All rights reserved.
- *
- *------------------------------------------------------------------------------
- * This file does the printing for this application
- *----------------------------------------------------------------------------*/
-
- #define __PRINTSTUFF__
-
- #pragma load "EdSampheaders" /* see the Buildheaders.c file */
-
- #include "EdSampdefines.h"
- /* prototypes */
-
-
- #pragma segment Print
- void PrintIt(WindowPtr theWind);
-
- /* external references */
-
- /* PrintIt prints the window passed to it. The Boolean tells the function */
- /* what to do when printing is finished. This is in place if Print was selected */
- /* from the Finder, the window will be closed after it's been printed */
- /* and the application will exit */
-
- void PrintIt(WindowPtr theWind)
- {
- THPrint myPrintRec;
- TPPrPort myPrintPort;
- TPrStatus myStats;
- extern WindowPtr gCurrentWindow;
- extern Boolean gShowPub;
- extern Boolean gShowSub;
- extern Boolean gShowingAll;
- Boolean temp1, temp2, temp3;
- windowCHandle drawers;
- temp1 = gShowPub;
- temp2 = gShowSub;
- temp3 = gShowingAll;
- gShowPub = gShowSub = gShowingAll = false;
- drawers = (windowCHandle)GetWRefCon(gCurrentWindow);
- HLock((Handle)drawers); /* lock it down so things don't get stupid */
- PrOpen();
- myPrintRec = (THPrint)NewHandle(sizeof(TPrint));
- PrintDefault(myPrintRec);
- if (PrJobDialog(myPrintRec)) {
- myPrintPort = PrOpenDoc(myPrintRec, nil, nil);
- PrOpenPage(myPrintPort, nil);
- /* jump to the drawing function stored for this window */
- (ProcPtr)((*drawers)->drawMe)(drawers, gCurrentWindow);
- HUnlock((Handle)drawers); /* all done */
- PrClosePage(myPrintPort);
- PrCloseDoc(myPrintPort);
- PrPicFile(myPrintRec, nil, nil, nil, &myStats);
- }
- DisposHandle((Handle)myPrintRec);
- PrClose();
- gShowPub = temp1;
- gShowSub = temp2;
- gShowingAll == temp3;
- }
-
-
- #undef __PRINTSTUFF__
-